When a device can't be allocated to dom0 by the IOMMU, don't leave
dom0 in the "domain" field. It causes pci_remove_device()
to crash trying to remove the dev from the domain's list of devices
(and was probably the wrong thing to do anyway).
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
pdev->domain = dom0;
ret = iommu_add_device(pdev);
if ( ret )
+ {
+ pdev->domain = NULL;
goto out;
+ }
list_add(&pdev->domain_list, &dom0->arch.pdev_list);
pci_enable_acs(pdev);
pdev->domain = dom0;
ret = iommu_add_device(pdev);
if ( ret )
+ {
+ pdev->domain = NULL;
goto out;
+ }
list_add(&pdev->domain_list, &dom0->arch.pdev_list);
pci_enable_acs(pdev);